import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;

@WebServlet("/showRequest")
public class ShowRequestServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        StringBuilder builder = new StringBuilder();
//        builder.append(req.getProtocol()); // 获取协议名称 和 版本号
//        builder.append("<br>"); // 换行
//
//        builder.append(req.getMethod());  // 获取协议的 方法
//        builder.append("<br>");
//
//
//
//        builder.append(req.getRequestURI());  // 获取 URL
//        builder.append("<br>");
//
//        builder.append(req.getQueryString());  // 获取查询字符串
//        builder.append("<br>");
//
//        Enumeration<String> headerNames = req.getHeaderNames();
//        while (headerNames.hasMoreElements()) {
//            String name = headerNames.nextElement();
//            builder.append(name + ": " + req.getHeader(name));
//        }
//
//        // 这里必须是 text/html, 必须是 /, 不能是 .
//        // 这个必须放在前面
//        resp.setContentType("text/html; charset=utf-8");
//        resp.getWriter().write(builder.toString());
        ObjectMapper objectMapper = new ObjectMapper();

    }
}
